refactor(usecases): rewrite pre-2018 ref-patterns to match ergonomics - #89
Merged
jhamill34 merged 2 commits intoAug 26, 2026
Merged
Conversation
Part of #85 (Phase 2 of #1). Converts every &Some(ref x)/match &value { &Variant(ref x) => ... } site in service_loader, execution_engine, and service_writer to plain match-ergonomics form (Some(x), Variant(x)) -- purely syntactic, binds the identical reference type as before. service_writer's clippy::ref_patterns/match_ref_pats/needless_borrowed_reference warnings are now fully zero; service_loader/execution_engine only retain pre-existing, out-of-scope warnings (too_many_lines, implicit_clone, etc.) tracked separately in #86. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018VzKriyNnMHmqQ6UxPhsv2
… pass traverse_map's if let &mut Value::Object(ref mut current) = current wasn't flagged by clippy::ref_patterns/needless_borrowed_reference (those lints don't cover &mut/ref mut shapes), but it's the same anti-pattern from #85's inventory. Same match-ergonomics fix as the rest of that PR. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018VzKriyNnMHmqQ6UxPhsv2
This was referenced Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #85 (Phase 2 of #1). Stacked on #88 (Phase 1's lint policy PR) since that's what re-enabled
clippy::ref_patterns/clippy::match_ref_pats/clippy::needless_borrowed_referencein the first place.Converts every pre-2018 explicit-deref match/if-let site in
usecases/*to plain match-ergonomics form:if let &Some(ref x) = &y { ... }→if let Some(x) = &y { ... }match &value { &Variant(ref x) => ..., ... }→match value { Variant(x) => ..., ... }(dropping&/reffrom each arm; keeping the&on the scrutinee where the matched value isn'tCopy/movable, so the binding mode —x: &T— is identical to before)|&(_, ref item)| item→|(_, item)| itemPurely syntactic — no behavior change, every site binds the exact same reference type as before.
Crates touched:
service_loader(6 sites — the 4 closure-pattern sites inloaders/openapi/mod.rsplus one inlib.rs),execution_engine(14 sites — 2 more than originally scoped, found via a fresh clippy run: amatches!macro use and one morematcharm),service_writer(11 sites).service_writernow has zeroref_patterns/match_ref_pats/needless_borrowed_referencewarnings.service_loader/execution_engineretain only pre-existing, out-of-scope warnings (too_many_lines,implicit_clone,doc_markdown) tracked in #86.Test plan
cargo build -p service_loader -p execution_engine -p service_writer— clean.cargo clippy -p service_loader -p execution_engine -p service_writer --all-features— zeroref_patterns/match_ref_pats/needless_borrowed_referencewarnings remaining in any of the three crates.cargo test -p service_loader -p execution_engine -p service_writer --all-features— 48 tests, 0 failures.cargo build --workspace --all-features— clean.cargo fmt --all -- --check— clean.Generated by Claude Code